package info.emamian.droplet.core.controllers;

import info.emamian.droplet.core.domain.repository.BasicSmsRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping(value = "/admin/sms")
@Controller
public class SMSAdminController {
	@Autowired
	BasicSmsRepository basicSmsRepository;

	@RequestMapping("/all")
	public String getAllSMS(Model model) {
		model.addAttribute("allsms", basicSmsRepository.findAll(new Sort(Direction.DESC, "date")));
		return "sms/all";
	}

}
